#include <iostream>
#include "Threadpool.hpp"
#include <time.h>
#include "Task.hpp"
#include <unistd.h>

int main()
{
    srand(time(nullptr));
    ThreadPool<Task<int>> *tp = new ThreadPool<Task<int>>(4);
    tp->start();
    while (true)
    {
        for (int i = 0; i < 10; i++)
        {
            int x = rand() % 10;
            usleep(10);
            int y = rand() % 10;
            Task<int> t(x, y, Task<int>::get_op()[rand() % Task<int>::get_op().size()]);
            std::cout << "拿到的任务..." << t.gettask() << std::endl;

            tp->push(t);
        }
        sleep(1);
    }
    return 0;
}